<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="head.jsp"/>
<!--中间内容-->
<div class="layui-container">
    <div class="layui-row ">
            <div class="fly-panel" style="margin-bottom: 0;">

                <c:if test="${blist.size()!=0}">
                    <ul class="fly-list">
                        <c:forEach items="${blist}" var="blog" >
                            <li>
                                <a href="${pageContext.request.contextPath}/blog/to_home.do?uId=${blog.user.uId}" class="fly-avatar">
                                    <img src="${pageContext.request.contextPath}${blog.user.uImage}" alt="${blog.user.userName}">
                                </a>
                                <h2>
                                    <a class="layui-badge">${blog.user.uType}</a>
                                    <a href="${pageContext.request.contextPath}/blog/content.do?bId=${blog.bId}">${blog.bTitle}</a>
                                </h2>
                                <div class="fly-list-info">
                                    <a href="${pageContext.request.contextPath}/blog/to_home.do?uId=${blog.user.uId}" >
                                        <cite>${blog.user.uNickName}</cite>
                                    </a>
                                    <span class="layui-badge layui-bg-gray">${blog.type.tName}</span>
                                    <span><spring:eval expression="blog.bCreateTime"/></span>
                                    <span class="fly-list-nums">
                                <i class="iconfont icon-pinglun1" title="评论"></i> ${blog.bCom==null?0:blog.bCom}
                            </span>
                                </div>
                            </li>
                        </c:forEach>
                    </ul>
                    <%--分页开始--%>
                    <%--分页--%>
                    <form action="${pageContext.request.contextPath}/blog/listKey.do" method="get">
                        <input type="hidden" name="title" value="${key}">
                        <div style="text-align: center">
                            <div class="laypage-main">
                                <c:if test="${pageInfo.hasPrePage}">
                                    <a href="${pageContext.request.contextPath}/blog/listKey.do?currentPage=1&title=${key}">首页</a>
                                    <a href="${pageContext.request.contextPath}/blog/listKey.do?currentPage=${pageInfo.currentPage-1}&title=${key}">上一页</a>
                                </c:if>
                                <c:if test="${pageInfo.hasPrePage==false}">
                                    <span>首页</span>
                                    <span>上一页</span>
                                </c:if>
                                <c:choose>
                                    <c:when test="${pageInfo.totalPage>5}">
                                        <c:forEach var="count" begin="1" end="5">
                                            <c:if  test="${pageInfo.currentPage==count}">
                                                <a href="${pageContext.request.contextPath}/blog/listKey.do?currentPage=${count}&title=${key}" class="laypage-curr">${count}</a>
                                            </c:if>
                                            <c:if test="${pageInfo.currentPage!=count}">
                                                <a href="${pageContext.request.contextPath}/blog/listKey.do?currentPage=${count}&title=${key}">${count}</a>
                                            </c:if>
                                        </c:forEach>
                                        <span>…</span>
                                    </c:when>
                                    <c:when test="${pageInfo.totalPage<=5}">
                                        <c:forEach var="count" begin="1" end="${pageInfo.totalPage}">
                                            <c:if test="${pageInfo.currentPage!=count}">
                                                <a href="${pageContext.request.contextPath}/blog/listKey.do?currentPage=${count}&title=${key}">${count}</a>
                                            </c:if>
                                            <c:if  test="${pageInfo.currentPage==count}">
                                                <a href="${pageContext.request.contextPath}/blog/listKey.do?currentPage=${count}&title=${key}" class="laypage-curr">${count}</a>
                                            </c:if>
                                        </c:forEach>
                                    </c:when>
                                </c:choose>

                                <c:if test="${pageInfo.hasNextPage}">
                                    <a href="${pageContext.request.contextPath}/blog/listKey.do?currentPage=${pageInfo.currentPage+1}&title=${key}">下一页</a>
                                    <a href="${pageContext.request.contextPath}/blog/listKey.do?currentPage=${pageInfo.totalPage}&title=${key}">尾页</a>
                                </c:if>
                                <c:if test="${pageInfo.hasNextPage==false}">
                                    <span> 下一页</span>
                                    <span> 尾页</span>
                                </c:if>
                            </div>
                            <div class="laypage-main" >
                                <cite> 共${pageInfo.totalPage}页</cite>
                            </div>
                            <span style="height: 100%; text-align: center;">
                        <div class="layui-inline" style="margin-top: 20px;margin-left: 2px; margin-right: 2px;">
                            <cite>到第</cite>
                            <div class="layui-input-inline" style="width: 50px;">
                              <input type="text" name="currentPage" autocomplete="off" class="layui-input">
                            </div>
                            <cite>页</cite>
				        </div>
                        <button type="submit" class="layui-btn" style="margin-top: 20px;">确定</button>
		            </span>
                            <div style="height: 10px;"></div>
                        </div>
                    </form>
                    <%--分页结束--%>
                </c:if>
                <c:if test="${blist.size()==0}">
                    <div class="fly-none"><img src="${pageContext.request.contextPath}/img/none.png"><h2>没有相关数据</h2></div>
                </c:if>


            </div>
    </div>
</div>
<!-- 中间内容结束 -->
<jsp:include page="bottom.jsp"/>
